package com.roy.galaxy.algorithm;

/**
 * @author gang.wang1903@xiaobao100.cn
 * @Date: 2019-10-10 09:46
 */
public class NumberOf1 {

    int NumberOf1(int n) {
        int count= 0;
        int base = 1;
        while(base!=0){
            if((n&base)!=0){
                count++;
            }
            base<<=1;
        }
        return count;
    }

}
